home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d3
/
ddjhptxt.arc
/
GESSNER.LST
< prev
next >
Wrap
File List
|
1990-06-05
|
30KB
|
554 lines
LISTING ONE
1| {$V-} {$F+} {$O+} { Written By: Rick Gessner, 1989. }
2|
3| Unit HyprText;
4| {-------} Interface {-----------------------------------------------}
5|
6| PROCEDURE Help_Editor(FileName: String);
7| PROCEDURE Do_help(FileName: String; GoPage,HomePage: Word);
8| {-------} Implementation {------------------------------------------}
9| Uses Crt;
10|
11| CONST HelpColor : Array[False..true] of Byte =
12| ( Black*16+White, { for normal text}
13| Magenta*16+Yellow); { for hot-link text.}
14| NormalColor : Byte = Black*16+White; { draw screen info.}
15| BoldColor : Byte = White*16+Black-Blink; { for select bar.}
16| Header : String[50] = ' HyperText System [1.0] ';
17| MaxLinesPerPage = 15;
18| MaxLineWidth = 57;
19|
20| PGUP = 'I'; PGDN = 'Q'; UpArrow = 'H'; {Edit keys}
21| DnArrow = 'P'; LArrow = 'K'; RArrow = 'M';
22| ESC = #27; HomeKey = 'G'; EndKey = 'O';
23| RETURN = ^M; BkSpc = #8; NULL = #0;
24| Tab = #9; F2 = '<'; DelKey = 'S';
25| Type HelpRecord = Record {The main structure for our hypertext files}
26| HelpLines : Array[1..MaxLinesPerPage] of String[100];
27| end; {String length MUST be > than MaxLineWidth to store hot-links!}
28| Var HelpRec : HelpRecord;
29| HelpFile : File of HelpRecord;
30| Alt,Ctrl,CommandKey : Boolean;
31| {--------------------------------------------------------------------}
32| FUNCTION Make_String(Ch : Char; Size : Integer) : String;
33| Var S: string;
34| Begin
35| S[0] := Chr(Size); { Set length byte = SIZE. }
36| FillChar(S[1],Size,Ch); { Fill the string with chr(CH). }
37| Make_String:= S; { and return the string as function}
38| end; {Make String } { value. }
39| {--------------------------------------------------------------------}
40| PROCEDURE Draw_Box(topx,topy,botx,boty: Byte; Color,Width: byte);
41| Type BoxPos = (TopL,TopR,BotL,BotR,Top,Bot,LSide,RSide);
42| Var Y : Integer;
43| Const Boxchar : Array[1..2,TopL..RSide] of char =
44| (( 'Z','?','@','Y','D','D','3','3'), {ASCII chars, single line box }
45| ( 'I',';','H','<','M','M',':',':')); {ASCII chars, double line box }
46| Begin
47| TextAttr:=Color;
48| If Not (Width in [1,2]) then Width:=1; { Sure width value is OK? }
49| Gotoxy(TopX,TopY); { First, draw the top line of the box...}
50| Write( BoxChar[Width,TopL]+Make_String(BoxChar[width,top],
51| BotX-TopX-1)+BoxChar[Width,TopR]);
52| For Y:=TopY+1 to BotY-1 do
53| Begin { Second, draw the middle lines of the box...}
54| Gotoxy(TopX,Y);
55| Write( BoxChar[Width,LSide],BoxChar[Width,RSide]:BotX-TopX);
56| end;
57| GotoXY(TopX,BotY); { Third, draw the bottom line of the box. }
58| Write( BoxChar[Width,BotL]+Make_String(BoxChar[width,top],BotX-TopX-1)+
59| BoxChar[Width,BotR])
60| end; {Draw Box}
61| {--------------------------------------------------------------------}
62| FUNCTION Read_KeyBoard: Char; {Routine to get keystrokes from user}
63| Const CtrlMask = $04;
64| AltMask = $08;
65| Var KBDFlag : Byte Absolute $0040:$0017;
66| Begin
67| Read_KeyBoard:=ReadKey;
68| CommandKey :=((KBDFlag AND AltMask)<>0) or ((KBDFlag AND CtrlMask)<>0);
69| ALT :=(KBDFlag AND AltMask)<>0; CTRL := (KBDFlag AND CtrlMask)<>0;
70| If KeyPressed Then
71| Begin
72| Read_Keyboard := ReadKey; {Just in case user pressed modified key}
73| CommandKey := True;
74| end;
75| end; {Read_Keyboard}
76| {--------------------------------------------------------------------}
77| PROCEDURE Show_HelpLine(X,Y,StartBold,EndBold: Integer; Var Line: String);
78| Var I,J: Integer;
79| PROCEDURE Write_Char(Ch: Char);
80| Begin
81| If Ord(Ch)>127 then Ch:=Chr(Ord(Ch)-128); {Clear high bit}
82| If Ord(Ch)>27 then Write(Ch) else Inc(i);
83| end;
84| Begin
85| TextAttr:=HelpColor[False];
86| Window(X,Y,59,Y); ClrEOL; Window(1,1,80,25); {Prepare for output}
87| Gotoxy(X,Y); I:=1;
88| While I<=Length(Line) do {Do each char in line}
89| Begin
90| TextAttr:=HelpColor[Ord(Line[i])>128]; {Set proper color}
91| If I in [StartBold..EndBold] then TextAttr:=BoldColor;
92| Write_Char(Line[i]);
93| Inc(i);
94| end;
95| end; {Show helpline}
96| {-------------------------------------------------------------------}
97| PROCEDURE Show_Help_Page(X,Y: Integer; Var HelpRec: HelpRecord);
98| Var I: Integer;
99| Begin
100| Window(X+1,Y+1,X+56,Y+MaxLinesPerPage+1); ClrScr; Window(1,1,80,25);
101| For I:=1 to MaxLinesPerPage do
102| Show_HelpLine(X,Y+I,0,0,HelpRec.HelpLines[I]);
103| end; {Show help page}
104| {-------------------------------------------------------------------}
105| FUNCTION Determine_Actual_Line_Pos(Var Line: String; LinePos:
106| Integer): Integer;
107| Var I,J: Integer; {Convert visual edit column to char. position,}
108| Begin {by skipping over embedded hot links.}
109| I:=0; J:=1;
110| While (J<=Length(Line)) and (I<>LinePos) do
111| Begin
113| Inc(i) else Inc(j,2);
113| Inc(j);
114| end;
115| Determine_Actual_Line_Pos:=J;
116| end; {Determine actual line pos}
117|
118| {-------------------------------------------------------------------}
119| FUNCTION Link_Count(Var Line: String): Integer;
120| Var I,Count: Integer; { Returns 2*#nulls in line, used to convert }
121| Begin { from actual byte pos. to visual byte pos., }
122| Count:=0; { during data input. }
123| For I:=1 to Length(Line) do
124| If Line[i]=Null then Inc(Count,2);
125| Link_Count:=Count;
126| end; {Link count}
127| {-------------------------------------------------------------------}
128| FUNCTION Input_HelpPage(X,Y: Byte; Var AHelpRec: HelpRecord): Char;
129| Var Ch : Char; { Main editing routine in this system. }
130| PageNum : Byte; { It is really just a page-oriented line }
131| I,J, { editor knows how to jump over 2-byte }
132| LinePos, { hot-links. }
133| RealLinePos, { If you add editing options, take }
134| LineNum : Integer;{ the embedded hot-links into account! }
135|
136| PROCEDURE Delete_Linked_Char(Var Line: String; LinePos: Integer);
137| Var I,J: Integer;
138| Begin
139| LinePos:=Pred(Determine_Actual_Line_Pos(Line,LinePos));
140| f Ord(Line[LinePos])>127 then {Were on a linked item}
141| egin
142| I:=LinePos;
143| While ((Ord(Line[I-1])>127) and (I>1)) do Dec(i);
144| J:=LinePos; {Next find end of link}
145| While ((Ord(Line[J+1])>127) and (I<Length(Line))) do Inc(J);
146| Delete(Line,LinePos, {Delete all of item + link if necc.}
147| 1+(2*Ord(J=I)));
148| end;
149| end; {Delete linked char}
150| Begin
151| Show_Help_Page(X,Y,AHelpRec); {Display this page }
152| LinePos:=1; RealLinePos:=1; {Now do a little init stuff.}
153| LineNum:=1;
154| With AHelpRec do {Now enter main edit loop...}
155| Repeat
156| Show_HelpLine(X,Y+LineNum,0,0,HelpLines[LineNum]);
157| Gotoxy(X+LinePos-1,Y+LineNum);
158| Repeat Ch:=Read_KeyBoard Until Ch <> Null;
159| If CommandKey then
160| Case Ch of
161| ^Y : If RealLinePos<=Length(HelpLines[LineNum]) then
162| Begin { ^Y = Delete to end of line. }
163| If (RealLinePos=1) then HelpLines[LineNum]:=''
164| else
165| Begin
166| While HelpLines[LineNum,RealLinePos]<>Null do
167| Delete(HelpLines[LineNum],RealLinePos,1);
168| If HelpLines[LineNum,RealLinePos]=Null then
169| Delete(HelpLines[LineNum],RealLinePos+2,255)
170| end
171| end;
172| F2 : Begin { F2 = Add/Remove hot-link.}
173| J:=RealLinePos;
174| While (j>0) and (HelpLines[LineNum,j]<>' ')
175| do Dec(j);
176| Inc(j);
177| If Ord(HelpLines[Linenum,j]) in [28..127] then
178| Repeat {Now get a valid page # to jump to...}
179| Gotoxy(3,24); Write('Link Page: ');
180| Readln(PageNum);
181| Gotoxy(3,24); ClrEOL;
182| Until (PageNum>0) and (PageNum<256);
183| While (HelpLines[LineNum,j]<>' ') and
184| (j<=Length(HelpLines[LineNum])) and
185| (HelpLines[LineNum,j]<>Null) do
186| Begin
187| HelpLines[LineNum,j]:=Chr(Ord(HelpLines
188| [LineNum,j])+128);
189| Inc(j);
190| end;
191| If Ord(HelpLines[LineNum,J-1]) in [28..127] then
192| Delete(HelpLines[LineNum],J,2) else
193| Insert(Null+Chr(PageNum),HelpLines[LineNum],j);
194| end;
195| LArrow : If RealLinePos>1 then {Move cursor left 1 char}
196| Begin
197| Dec(linePos);
198| RealLinePos:=Pred(Determine_Actual_Line_Pos
199| (HelpLines[LineNum],LinePos));
200| end;
201| RArrow : If RealLinePos<=Length(HelpLines[LineNum]) then
202| Begin {Move cursor right 1 char}
203| Inc(LinePos);
204| If RealLinePos<Length(HelpLines[LineNum]) then
205| Inc (RealLinePos,
206| 1+Ord(HelpLines[LineNum,RealLinePos+1]=Null)*2)
207| else Inc(realLinePos)
208| end;
209| DnArrow: If LineNum<MaxLinesPerPage then
210| Begin {Move down 1 line.}
211| Inc(LineNum);
212| If LinePos<=Length(HelpLines[LineNum]) then
213| RealLinePos:=Pred(Determine_Actual_Line_Pos
214| (HelpLines[LineNum],LinePos))
215| else
216| Begin
217| RealLinePos:=Succ(Length(HelpLines[LineNum]));
218| LinePos:=RealLinePos-Link_Count(HelpLines[LineNum]);
219| end;
220| end;
221| UpArrow: If LineNum>1 then {Move up 1 line.}
222| Begin
223| Dec(LineNum);
224| If LinePos<=Length(HelpLines[LineNum]) then
225| RealLinePos:=Pred(Determine_Actual_Line_Pos
226| (HelpLines[LineNum],LinePos))
227| else
228| Begin
229| RealLinePos:=Succ(Length(HelpLines[LineNum]));
230| LinePos:=RealLinePos-Link_Count(HelpLines[LineNum]);
231| end;
232| end;
233| HomeKey: Begin {Move to 1 char. in line.}
234| LinePos:=1;
235| RealLinePos:=LinePos;
236| end;
237| EndKey : Begin {Move to end of line.}
238| RealLinePos:=Succ(Length(HelpLines[LineNum]));
239| LinePos:=RealLinePos-Link_Count(HelpLines[LineNum]);
240| end;
241| DelKey : If (RealLinePos<=Length(HelpLines[LineNum])) then
242| Begin {Delete a character.}
243| If (HelpLines[LineNum,RealLinePos]) in [' '..'}']
244| then Delete(HelpLines[LineNum],RealLinePos,1) else
245| Delete_Linked_Char(HelpLines[LineNum],LinePos);
246| RealLinePos:=Pred(Determine_Actual_Line_Pos
247| (HelpLines[LineNum],LinePos));
248| end;
249| end else
250| Case Ch of
251| Return: If LineNum<MaxLinesPerPage then {Move down 1 line}
252| Begin
253| Inc(LineNum); LinePos:=1; RealLinePos:=1;
254| end;
255| Tab : Begin {Tab right 10 chars.}
256| If RealLinePos+10<=Length(HelpLines[LineNum])+1 then
257| Inc(RealLinePos,10) else
258| RealLinePos:=Length(HelpLines[LineNum])+1;
259| LinePos:=RealLinePos-Link_Count(HelpLines[LineNum]);
260| end;
261| BkSpc : If RealLinePos>1 then {Backspace }
262| Begin
263| If HelpLines[LineNum,RealLinePos-1] in [' '..'}'] then
264| Begin
265| Delete(HelpLines[LineNum],RealLinePos-1,1);
266| Dec(RealLinePos);
267| Dec(LinePos)
268| end else
269| Begin
270| Delete_Linked_Char(HelpLines[LineNum],LinePos-1);
271| Dec(LinePos);
272| RealLinePos:=Pred(Determine_Actual_Line_
273| Pos(HelpLines[LineNum],LinePos));
274| end;
275| end;
276| ' '..'}' : If Length(HelpLines[LineNum])<MaxLineWidth then
277| Begin {Insert a valid Ascii char.}
278| If (Ord(HelpLines[LIneNum,RealLinePos])>127) and
279| (RealLinePos<=Length(HelpLines[Linenum])) then
280| Ch:=Chr(Ord(Ch)+128);
281| Insert(Ch,HelpLines[LineNum],RealLinePos);
282| Inc(RealLinePos);
283| Inc(LinePos); Ch:=#255;
284| end;
285| end;
286| Until CH in [ESC,PGUp,PgDn]; {ESC=Quit;PGUp=Prev page;PgDn=Next Page.}
287| Input_HelpPage:=Ch;
288| end; {Input helppage}
289| {--------------------------------------------------------------------}
290| FUNCTION Read_Helprec(Var AHelpRec: HelpRecord; RecNum: Integer):Integer;
291| Var I : Integer;
292| Begin
293| FillChar(AHelprec,SizeOf(AHelprec),0); {$I-} {Hyperdata file read }
294| If FileSize(HelpFile)<RecNum then exit; {routine. Includes just }
295| Seek(helpfile,RecNum-1); {enough error checking }
296| Read(helpfile,AHelpRec); {to be considered safe. }
297| Read_HelpRec:=IOResult; {$I+}
298| end; {Read helprec}
299| {--------------------------------------------------------------------}
300| FUNCTION Write_HelpRec(Var AHelpRec: HelpRecord; RecNum:Integer):Integer;
301| Begin {$I-}
302| Seek(helpfile,RecNum-1); {Hyperdata file write routine.}
303| Write(helpfile,AHelpRec); {$I+} {This routine contains just }
304| Write_HelpRec:=IOresult; {enough error checking to be}
305| end; {Write helprec} {considered safe.}
306| {--------------------------------------------------------------------}
307| FUNCTION Open_HelpFile(FileName: String): Integer;
308| Var result: Integer;
309| Begin
310| Assign(HelpFile,FileName); {$I-} {Opens hyperdata file specified}
311| Reset(HelpFile); {as "FileName". If the file }
312| result:=IOResult; {doesnt exist, then it will be }
313| If Result=2 then {created. }
314| Begin {Error checking is limited, but}
315| ReWrite(HelpFile); {enough to be safe. }
316| Result:=IOResult;
317| end;
318| Open_HelpFile:=Result;
319| end; {open helpfile}
320| {--------------------------------------------------------------------}
321| PROCEDURE Help_Editor(FileName: String);
322| Const HelpMsgs = 13;
323| HelpData : Array[1..HelpMsgs] of String[17] =
324| ( 'Editing Keys: ', '-------------',
325| 'F2 : Link (+/-)', '^Y : Del EOLine',
326| 'Bkspc: Del left', 'Del : Del char',
327| Chr(10)+'Movement keys: ', '--------------',
328| Chr(24)+Chr(25)+Chr(27)+Chr(26)+', '+Chr(17)+Chr(217)+',',
329| 'Tab, Home, End', 'PgUp : Prev page',
330| 'PgDn : Next page', Chr(10)+'ESC to quit.');
331| Var I,HelpRecNum: Integer;
332| AHelpRec : HelpRecord;
333| Ch : Char;
334| Result : Integer;
335| Begin
336| Result:=Open_HelpFile(FileName); {Open the specified file.}
337| If Result=0 then {Continue only if no error.}
338| Begin
339| TextAttr := NormalColor;
340| Draw_Box(1,3,80,23,NormalColor,1);
341| Draw_Box(2,4,60,22,NormalColor,2);
342| Gotoxy(61,4);
343| For I:=1 to HelpMsgs do
344| Begin
345| Gotoxy(62,WhereY+1); Write(HelpData[i]);
346| end;
347| HelpRecNum:=1;
348| Gotoxy(40-(Length(Header) div 2),3); Writeln(Header);
349| Gotoxy(4,2); Writeln('File: ',FileName);
350| Repeat
351| Gotoxy(4,4); Writeln(' Reading ');
352| Result:=Read_HelpRec(AHelpRec,HelpRecNum);
353| Gotoxy(4,4); Writeln('Page: ',HelpRecNum:3);
354| Ch:=Input_HelpPage(3,4,AHelpRec);
355| Result:=Write_HelpRec(AHelpRec,HelpRecNum);
356| Gotoxy(4,4); Writeln(' Writing ');
357| Case Ch of
358| PgUp : If helpRecNum>1 then Dec(HelpRecNum);
359| PgDn : If HelpRecNum < 255 then Inc(HelpRecNum);
360| end;
361| Until Ch=ESC;
362| end else {Report the opening error...}
363| Writeln('ERROR: ',Result,' opening ',FileName,'. Unable to continue.');
364| {$I-} Close(HelpFile); Result:=IOresult; {$I+}
365| end; {Help editor}
366| {--------------------------------------------------------------------}
367| FUNCTION Find_Next_Link( Var X,Y: Integer; EndX,EndY: Integer;
368| Var AHelpRec: HelpRecord): Boolean;
369| Var OrigX,OrigY,Col, {Recursive routine used to find a }
370| Row,StartCol,StopCol: Integer; {hot-link on the page after the }
371| Begin {current page position (X,Y). }
372| Find_Next_Link:=False;
373| {First, search from current pos to end of page...}
374| For Row:=Y to EndY do
375| Begin
376| If Row<>Y then StartCol:=1 else StartCol:=X;
377| If Row<>EndY then StopCol:=Length(AhelpRec.HelpLines[Row])
378| else StopCol:=EndX;
379| If AhelpRec.HelpLines[Row]<>'' then
380| For Col:=StartCol to StopCol do
381| If (AHelpRec.HelpLines[Row,Col]=Null) then
382| Begin
383| Find_Next_Link:=True;
384| X:=Col; Y:=Row;
385| Exit; {make a quick getaway!}
386| end;
387| end;
388| {ok, search from top of page to the startpos}
389| If X+Y>2 then
390| Begin
391| Col:=1; Row:=1;
392| If Find_Next_link(Col,Row,Pred(X),Y,AHelpRec) then
393| Begin
394| X:=Col; Y:=Row; Find_Next_Link:=true;
395| end
396| end;
397| end; {find next link}
398| {--------------------------------------------------------------------}
399| FUNCTION Find_Prev_Link( Var X,Y: Integer; EndX,EndY: Integer;
400| Var AHelpRec: HelpRecord): Boolean;
401| Var OrigX,OrigY,Col, {Recursive routine used to find a }
402| Row,StartCol,StopCol: Integer; {hot-link on the page prev. to the}
403| Begin {current page pos. (X,Y). }
404| Find_Prev_Link:=False;
405| {First, search from current pos to top of page...}
406| For Row:=Y downto 1 do
407| Begin
408| StopCol:=1;
409| If Row<>Y then StartCol:=Length(AhelpRec.HelpLines[Row])
410| else StartCol:=X;
411| If AhelpRec.HelpLines[Row]<>'' then
412| For Col:=StartCol downto StopCol do
413| If (AHelpRec.HelpLines[Row,Col]=Null) then
414| Begin
415| Find_Prev_Link:=True;
416| X:=Col; Y:=Row;
417| Exit; {make a quick getaway!}
418| end;
419| end;
420| {ok, search from bottom of page to the startpos}
421| If X+Y>2 then
422| Begin
423| Row:=MaxLinesPerPage;
424| Col:=Length(AHelpRec.HelpLines[Row]);
425| If Find_Prev_link(Col,Row,Succ(X),Y,AHelpRec) then
426| Begin
427| X:=Col; Y:=Row; Find_Prev_Link:=true;
428| end
429| end;
430| end; {find prev link}
431| {--------------------------------------------------------------------}
432| PROCEDURE Do_Help(FileName: String; GoPage,HomePage: Word);
433| Const XPos = 10;
434| YPos = 5;
435| Color : Byte = Black*16+White; {This is hypertext engine.}
436| MaxStackSize = 25; {This routine used to read }
437| {and navigate through data }
438| Type StackRec = Record {file, "FILENAME".}
439| Page : Byte; {GoPage is starting}
440| Row, {page to display; HomePage}
441| Col : Integer; {is used to specify an main }
442| end; {index (or home) page. }
443| Var Result : Integer;
444| Stack : Array[0..MaxStackSize] of StackRec;
445| AHelpRec: HelpRecord;
446| Ch : CHar;
447| StackLvl: Byte;
448| StartCol: Integer;
449| Linked,
450| Load : Boolean;
451| FUNCTION Pop_Stack: Byte; {Pop the top page info (Stack) record}
452| Begin
453| If StackLvl>1 then
454| Begin
455| Dec(StackLvl);
456| Load:=True;
457| end;
458| Pop_Stack:=StackLvl;
459| end; {pop stack}
460| FUNCTION Push_Stack(PageNum: Byte): Byte;
461| Begin {Push a page info (stack) record.}
462| Inc(StackLvl);
463| Stack[StackLvl].Page:=PageNum;
464| Stack[StackLvl].Col:=1;
465| Stack[StackLvl].Row:=1;
466| Push_Stack:=StackLvl;
467| end; {push stack}
468| Begin
469| If GoPage=0 then GoPage:=1; {Make sure GoPage is valid.}
470| Result:=Open_HelpFile(FileName);
471| If Result=0 then
472| Begin
473| Load:=true;
474| TextAttr :=Color;
475| Draw_Box(Xpos,YPos,XPos+59,YPos+MaxLinesPerPage+2,NormalColor,2);
476| FillChar(Stack,SizeOf(Stack),0);
477| StackLvl := 0;
478| If HomePage in [1..255] then StackLvl:=Push_Stack(HomePage);
479| If (GoPage in [1..255]) and (GoPage<>HomePage) then
480| StackLvl:=Push_Stack(GoPage);
481| GotoXY(XPos+29-(Length(Header) div 2),YPos);
482| Writeln(Header);
483| Repeat
484| With Stack[StackLvl] do
485| Begin
486| If Load then {System needs new hyperdata file page.}
487| Begin
488| Result:=Read_HelpRec(AHelpRec,Page);
489| Show_Help_Page(XPos+1,YPos,AHelpRec);
490| Gotoxy(XPos+51,YPos+MaxLinesPerPage+2);
491| If StackLvl>1 then Write('Esc,PgUp') else
492| Write('Esc=Quit');
493| Linked:=Find_Next_Link(Col,Row,80,
494| MaxLinesPerPage,AHelpRec);
495| Load:=False;
496| end;
497| If Linked then {We have a hot-link to show, so do it.}
498| Begin
499| StartCol := Col;
500| While Ord(AHelprec.HelpLines[Row,StartCol-1])>127
501| do Dec(StartCol);
502| Show_HelpLine(XPos+1,YPos+Row,StartCol,Pred(Col),
503| AHelpRec.HelpLines[Row]);
504| end;
505| Repeat Ch:=Read_KeyBoard until Ch<>Null;
506| Show_HelpLine(XPos+1,YPos+Row,0,0,AHelpRec.HelpLines[Row]);
507| Case Ch of {Now handle navigation...}
508| RArrow,
509| Tab : Begin
510| Inc(Col);
511| Linked:=Find_Next_Link(Col,Row,80,
512| MaxLinesPerPage,AHelpRec);
513| end;
514| Return : If Linked then
515| Begin
516| Load:=true;
517| If (StackLvl>1) and
518| (Stack[StackLvl-1].Page=
519| Ord(AHelpRec.HelpLines[Row,Col+1])) then
520| StackLvl:=Pop_Stack else
521| StackLvl:=Push_Stack(Ord(AHelpRec.HelpLines
522| [Row,Col+1]));
523| end;
524| LArrow : Begin
525| Dec(Col);
526| Linked:=Find_Prev_Link(Col,Row,1,1,AHelpRec);
527| end;
528| DnArrow: Begin
529| Col:=1;
530| If Row<MaxLinesPerPage then Inc(Row) else Row:=1;
531| Linked:=Find_Next_Link(Col,Row,80,
532| MaxLinesPerPage,AHelprec);
533| end;
534| UpArrow: Begin
535| If Row>1 then Dec(Row) else Row:=MaxLinesPerPage;
536| If Col<Length(AHelpRec.HelpLines[Row])
537| then Inc(Col);
538| Linked:=Find_Prev_Link(Col,Row,1,1,Ahelprec);
539| end;
540| PgUp : StackLvl:=Pop_Stack;
541| PgDn : Begin {Let programmer set this!} end;
542| end;
543| end;
544| Until Ch=ESC;
545| end else
546| Writeln('ERROR: ',Result,' opening ',FileName,'. Unable to continue.');
547| {$I-} Close(HelpFile); result:=IOResult; {$I+}
548| end; {do help}
549| {--------------------------------------------------------------------}
550| Begin {No init code required}
551| end.